/**
 * Created by coder on 2018/3/30.
 */
export default function compare(a, b) {
	// Of course, we can do it use for in
	// Create arrays of property names
	var aProps = Object.getOwnPropertyNames(a);
	var bProps = Object.getOwnPropertyNames(b);

	// If number of properties is different,
	// objects are not equivalent
	if (aProps.length != bProps.length) {
		return false;
	}

	for (var i = 0; i < aProps.length; i++) {
		var propName = aProps[i];

		if(propName == '__ob__'){
			continue;
		}
		// If values of same property are not equal,
		// objects are not equivalent
		if(typeof(a[propName]) == 'object'){
			if(!compare(a[propName],b[propName])){
				return false;
			}
		} else {
			if (a[propName] !== b[propName]) {
				return false;
			}
		}

	}

	// If we made it this far, objects
	// are considered equivalent
	return true;
}